{#**
*
* 功能描述（收货地址模板）
*
* @author suoya <jlusuoya@gmail.com>
* @version 1
*#}

{#include file="header.tpl" title="地址" menuIdx=2 headImg="user" #}
<div class="block box">
    <div id="ur_here" class="user_here">
        当前位置: <a href="#">首页</a> <code>/</code> 用户中心 <code>/</code> 收货地址 </div>
</div>
<div class="block clearfix">
    <div class="AreaR" style="width:996px">
        <div class="box">
            <div class="box_1">
                <div class="userCenterBox boxCenterList clearfix" style="_height:1%;">
                    <script type="text/javascript" src="js/region.js"></script><script type="text/javascript" src="js/shopping_flow.js"></script>            <script type="text/javascript">
                        region.isAdmin = false;
                        var consignee_not_null = "收货人姓名不能为空！";
                        var province_not_null = "请您选择收货人所在省份！";
                        var city_not_null = "请您选择收货人所在城市！";
                        var district_not_null = "请您选择收货人所在区！";
                        var area_not_null = "请您选择收货人所在区域！";
                        var invalid_email = "您输入的邮件地址不是一个合法的邮件地址。";
                        var address_not_null = "收货人的详细地址不能为空！";
                        var mobile_to_err = "收货人手机不正确！";
                        var mobile_from_err = "订货人手机不能为空！";
                        var shipping_not_null = "请您选择配送方式！";
                        var payment_not_null = "请您选择支付方式！";
                        var goodsattr_style = "1";
                        var tele_invaild = "收货人手机号码输入有误。";
                        var zip_not_num = "邮政编码只能填写数字";
                        var mobile_invaild = "订货人手机号码输入有误。";
                        var best_shipping_time_required = "请选择最佳送货日期和时间。";

						$(document).ready(function(){
							document.forms['theForm'].reset();
							region.loadFirstRegions(0, 0, 'selProvinces_0');
							$("#selProvinces_0").val(19);
							$("#selProvinces_0").change();
                        });
						function DelAddress(id)
						{
							if (!confirm('你确认要删除该收货地址吗？'))
								return;
							if(ajax_call('index.php?action=user.deladdress&address_id='+id))
								$("#form_add_"+id).remove();
						}
                    </script>
                    {#foreach $address as $item #}
                        <form id = "form_add_{#$item['id']#}" action="index.php?action=user.addAddress" method="post" onsubmit="return checkConsignee(this)">
                            <table width="100%" border="0" cellpadding="8" cellspacing="1">
                                <tbody><tr>
                                        <td align="right" bgcolor="#ffffff">配送区域：</td>
                                        <td colspan="3" align="left" bgcolor="#ffffff">
                                            <select name="province" id="selProvinces_{#$item['id']#}" onchange="region.changed(this, 1, 'selCities_{#$item['id']#}')">
                                                <option value="0">请选择省</option>
                                                <option value="1" >省份1</option>
                                                <option value="2" >省份2</option>
                                            </select>
                                            <select name="city" id="selCities_{#$item['id']#}" onchange="region.changed(this, 2, 'selDistricts_{#$item['id']#}')">
                                                <option value="0">请选择市</option>
                                            </select>
                                            <select name="district" id="selDistricts_{#$item['id']#}" onchange="region.changed(this, 3, 'selArea_{#$item['id']#}')">
                                                <option value="0">请选择区</option>
                                            </select>
                                            <select name="area" id="selArea_{#$item['id']#}" style="display:none">
                                                <option value="0">请选择区域</option>
                                            </select>
                                            <input name="address" type="text" class="inputBg1" value="{#$item['address']#}">
                                            (必填) </td>
                                    </tr>
                                    <tr>
                                        <td align="right" bgcolor="#ffffff">收货人姓名：</td>
                                        <td align="left" bgcolor="#ffffff"><input name="consignee" type="text" class="inputBg1" value="{#$item['consignee']#}">
                                            (必填) </td>				  
                                    </tr>
                                    <tr>
                                        <td align="right" bgcolor="#ffffff">收货人手机：</td>
                                        <td align="left" bgcolor="#ffffff"><input name="mobile_to" type="text" class="inputBg1" value="{#$item['mobile_to']#}">
                                            (必填)</td>				  
                                    </tr>				
                                    <tr>
                                        <td align="right" bgcolor="#ffffff">订货人手机：</td>
                                        <td align="left" bgcolor="#ffffff"><input name="mobile_from" type="text" class="inputBg1" value="{#$item['mobile_from']#}">
                                            (必填)</td>			  
                                    </tr>
                                    <tr>
                                        <td align="right" bgcolor="#ffffff">&nbsp;</td>
                                        <td colspan="3" align="right" bgcolor="#ffffff" style="padding-right:90px;padding-top:30px;">
                                            <input type="submit" name="submit" class="bnt_blue_1 bnt_edit" value="">
                                            <input name="button" type="button" class="bnt_blue bnt_del" onclick="DelAddress({#$item['id']#})" />
                                            <input name="address_id" type="hidden" value="{#$item['id']#}">
                                        </td>
                                    </tr>
                                </tbody></table>
                        </form>
                        <script>
							region.loadFirstRegions(0, 0, 'selProvinces_{#$item['id']#}');
                            $("#selProvinces_{#$item['id']#}").val({#$item['province']#});
                            $("#selProvinces_{#$item['id']#}").change();
                            $("#selCities_{#$item['id']#}").val({#$item['city']#});
                            $("#selCities_{#$item['id']#}").change();
                            $("#selDistricts_{#$item['id']#}").val({#$item['district']#});
                            $("#selDistricts_{#$item['id']#}").change();
                            $("#selArea_{#$item['id']#}").val({#$item['area']#});
                        </script>
                        <div class="line_red"></div>
                    {#/foreach#}
                    <form action="index.php?action=user.addAddress" method="post" name="theForm" onsubmit="return checkConsignee(this)">
                        <table width="100%" border="0" cellpadding="8" cellspacing="1">
                            <tbody><tr>
                                    <td align="right" bgcolor="#ffffff">配送区域：</td>
                                    <td colspan="3" align="left" bgcolor="#ffffff">
                                        <select name="province" id="selProvinces_0" onchange="region.changed(this, 1, 'selCities_0')">
                                            <option value="0">请选择省</option>
                                            <option value="1" >省份1</option>
                                            <option value="2" >省份2</option>
                                        </select>
                                        <select name="city" id="selCities_0" onchange="region.changed(this, 2, 'selDistricts_0')">
                                            <option value="0">请选择市</option>
                                        </select>
                                        <select name="district" id="selDistricts_0" onchange="region.changed(this, 3, 'selArea_0')">
                                            <option value="0">请选择区</option>
                                        </select>
                                        <select name="area" id="selArea_0" style="display:none">
                                            <option value="0">请选择区域</option>
                                        </select>
                                        <input name="address" type="text" class="inputBg1" value="">
                                        (必填) </td>			  
                                </tr>
                                <tr>
                                    <td align="right" bgcolor="#ffffff">收货人姓名：</td>
                                    <td align="left" bgcolor="#ffffff"><input name="consignee" type="text" class="inputBg1" value="">
                                        (必填) </td>				  
                                </tr>
                                <tr>
                                    <td align="right" bgcolor="#ffffff">收货人手机：</td>
                                    <td align="left" bgcolor="#ffffff"><input name="mobile_to" type="text" class="inputBg1" value="{#$mobile#}">
                                        (必填)</td>				  
                                </tr>				
                                <tr>
                                    <td align="right" bgcolor="#ffffff">订货人手机：</td>
                                    <td align="left" bgcolor="#ffffff"><input name="mobile_from" type="text" class="inputBg1" value="{#$mobile#}">
                                        (必填)</td>			  
                                </tr>
                                <tr>
                                    <td align="right" bgcolor="#ffffff">&nbsp;</td>
                                    <td colspan="3" align="right" bgcolor="#ffffff" style="padding-right:90px;padding-top:30px;">
                                        <input type="submit" name="submit" class="button_nomarl" value="新增收货地址">
                                        <input name="address_id" type="hidden" value="">
                                    </td>
                                </tr>
                            </tbody></table>
                    </form>
                    <div class="line_red"></div>
                </div>
            </div>
        </div>
    </div>
</div>
{#include file="footer.tpl"#}
